import "https://cdn.jsdelivr.net/npm/xlsx/dist/xlsx.full.min.js";

async function transJsonFileToXlsx(jsonFile) {
    console.log(jsonFile);
    const json = await jsonFile.text();
    const sheet = XLSX.utils.json_to_sheet(JSON.parse(json));
    const book = XLSX.utils.book_new();
    XLSX.utils.book_append_sheet(book, sheet);
    XLSX.writeFile(book, jsonFile.name + ".xlsx");
}
document.getElementById("jsonUpload").addEventListener("input", (e) => {
    transJsonFileToXlsx(e.target.files[0]);
});
